class Solution:
    def findDiagonalOrder(self, nums: list) -> list:
        """TLE
        """
        row = len(nums)
        col = 0
        for i in range(len(nums)):
            col = max(col, len(nums[i]))
        ans = []
        start = 0
        while start < row:
            i = start
            j = 0
            while j <= start and i >= 0:
                if j < len(nums[i]):
                    ans.append(nums[i][j])
                i -= 1
                j += 1
            start += 1
        start = 1
        while start < col:
            i = row - 1
            j = start
            while j < col and i >= 0:
                if j < len(nums[i]):
                    ans.append(nums[i][j])
                i -= 1
                j += 1
            start += 1
        return ans
